<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>题目</title>
</head>
<body>
<script>
  //代码一
  /*setTimeout(()=>{
    console.log('timeout')
  },0)

  Promise.resolve(1).then(
          value => console.log('成功1',value)
  )
  Promise.resolve(2).then(
          value => console.log('成功2',value)
  )
  console.log('主线程')*/


  //代码二
   /*setTimeout(()=>{
    console.log('timeout1')
  })
  setTimeout(()=>{
    console.log('timeout2')
  })

  Promise.resolve(1).then(
    value => console.log('成功1',value)
  )
  Promise.resolve(2).then(
    value => console.log('失败2',value)
  )*/

  //代码三
  setTimeout(()=>{
    console.log('timeout1')
    Promise.resolve(5).then(
            value => console.log('成功了5')
    )
  })
  setTimeout(()=>{
    console.log('timeout2')
  })

  /**/
  Promise.resolve(3).then(
          value => console.log('成功了3')
  )
  Promise.resolve(4).then(
          value => console.log('失败了4')
  )
</script>

</body>
</html>